package com.example.demo.util.craw;

import java.util.Date;

/**
 * Description: <br/>
 *
 * @author liulonglong<br       />;
 * @taskId <br/>
 * @Date 2019/5/23 13:37
 * @Version 1.0
 */
public abstract class AbstractJob implements IJob {

    @Override
    public void beforeRun() {
        System.out.println("抓取前.....");
    }

    @Override
    public void afterRun() {
        System.out.println("抓取后.......");
    }

    /**
     * 具体的抓去网页的方法， 需要子类来补全实现逻辑
     *
     * @throws Exception
     */
    public abstract void doFetchPage() throws Exception;

    @Override
    public void run() {
        this.beforeRun();
        try {
            this.doFetchPage();
        } catch (Exception e) {
            e.printStackTrace();
        }
        this.afterRun();
    }

}
